home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group92c.txt / 000018_icon-group-sender _Tue Oct 13 11:31:31 1992.msg < prev    next >
Internet Message Format  |  1993-01-04  |  1KB

  1. Received: by cheltenham.cs.arizona.edu; Mon, 19 Oct 1992 11:34:01 MST
  2. Message-Id: <199210131550.AA16871@optima.cs.arizona.edu>
  3. To: icon-group-request@cs.arizona.edu
  4. From: UBY@CU.NIH.GOV
  5. Date:     Tue, 13 Oct 1992  11:31:31 EDT
  6. Subject:  How to skip comments?
  7. Status: RO
  8. Errors-To: icon-group-errors@cs.arizona.edu
  9.  
  10. I have been trying to modify the concord.icn program from the Icon program
  11. library to produce cross-reference tables for SAS programs, but I am stumped
  12. about how to skip over comments.  Comments in the SAS language are of the form
  13. /* ..... */.  I have not been able to figure out how to skip the comments and
  14. still persuade A*B to parse as A and B. The relevent code is appended.  Any
  15. suggestions would be greatly appreciated.
  16.  
  17. Thanks,
  18.  
  19. Jim Blakley    UBY@NIHCU.BITNET
  20.  
  21. An Icon novice in over his depth
  22.  
  23.  
  24.  
  25. procedure item()
  26.    local i, word, line
  27.    static char1, sasvar, sas
  28.  
  29.    initial {
  30.       char1 := '&%_' ++ &letters
  31.       sasvar := char1 ++ &digits
  32.       }
  33.  
  34.    while line := read() do {
  35.       lineno +:= 1
  36.       write(right(lineno, 6), "  ", line)
  37.       line := map(line)                                # fold to lowercase
  38.       i := 1
  39.       line ? {
  40.          while tab(upto(sasvar)) do {
  41.             word := tab(many(sasvar))
  42.             if member(keywords, word) then next   # skip reserved words
  43.             if word ? any(char1) then suspend word   # skip numbers
  44.             }
  45.          }
  46.       }
  47. end
  48.  
  49.  
  50.